home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / MALLOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  2.8 KB  |  123 lines

  1. /***
  2. *malloc.h - declarations and definitions for memory allocation functions
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    Contains the function declarations for memory allocation functions;
  8. *    also defines manifest constants and types used by the heap routines.
  9. *    [System V]
  10. *
  11. ****/
  12.  
  13.  
  14. #define _HEAPEMPTY    -1
  15. #define _HEAPOK     -2
  16. #define _HEAPBADBEGIN    -3
  17. #define _HEAPBADNODE    -4
  18. #define _HEAPEND    -5
  19. #define _HEAPBADPTR    -6
  20. #define _FREEENTRY    0
  21. #define _USEDENTRY    1
  22.  
  23. #ifndef _SIZE_T_DEFINED
  24. typedef unsigned int size_t;
  25. #define _SIZE_T_DEFINED
  26. #endif
  27.  
  28. #if (!defined(NO_EXT_KEYS))
  29.  
  30. #ifndef    _HEAPINFO_DEFINED
  31. typedef struct _heapinfo {
  32.     int far * _pentry;
  33.     size_t _size;
  34.     int _useflag;
  35.     } _HEAPINFO;
  36. #define    _HEAPINFO_DEFINED
  37. #endif
  38.  
  39. #else    /* NO_EXT_KEYS */
  40. #if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  41.  
  42. #ifndef    _HEAPINFO_DEFINED
  43.  
  44. typedef struct _heapinfo {
  45.     int * _pentry;
  46.     size_t _size;
  47.     int _useflag;
  48.     } _HEAPINFO;
  49.  
  50. #define    _HEAPINFO_DEFINED
  51. #endif
  52.  
  53. #endif    /* M_I86CM || M_I86LM || M_I86HM */
  54.  
  55. #endif    /* NO_EXT_KEYS */
  56.  
  57.  
  58. #if (defined(M_I86SM) || defined(M_I86MM))
  59. #define _heapchk  _nheapchk
  60. #define _heapset  _nheapset
  61. #define _heapwalk _nheapwalk
  62. #endif
  63. #if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  64. #define _heapchk  _fheapchk
  65. #define _heapset  _fheapset
  66. #define _heapwalk _fheapwalk
  67. #endif
  68.  
  69. #ifndef NO_EXT_KEYS    /* extensions enabled */
  70.     #define _CDECL    cdecl
  71.     #define _NEAR    near
  72. #else /* extensions not enabled */
  73.     #define _CDECL
  74.     #define _NEAR
  75. #endif /* NO_EXT_KEYS */
  76.  
  77.  
  78. /* external variable declarations */
  79. extern unsigned int _NEAR _CDECL _amblksiz;
  80.  
  81. /* function prototypes */
  82.  
  83. void * _CDECL alloca(size_t);
  84. void * _CDECL calloc(size_t, size_t);
  85. void * _CDECL _expand(void *, size_t);
  86. int _CDECL _fheapchk(void);
  87. int _CDECL _fheapset(unsigned int);
  88. unsigned int _CDECL _freect(size_t);
  89. void _CDECL free(void *);
  90. void * _CDECL malloc(size_t);
  91. size_t _CDECL _memavl(void);
  92. size_t _CDECL _memmax(void);
  93. size_t _CDECL _msize(void *);
  94. int _CDECL _nheapchk(void);
  95. int _CDECL _nheapset(unsigned int);
  96. void * _CDECL realloc(void *, size_t);
  97. void * _CDECL sbrk(int);
  98. size_t _CDECL stackavail(void);
  99.  
  100.  
  101. #ifndef NO_EXT_KEYS    /* extensions enabled */
  102.  
  103. void cdecl _ffree(void far *);
  104. void far * cdecl _fmalloc(size_t);
  105. size_t cdecl _fmsize(void far *);
  106. void huge * cdecl halloc(long, size_t);
  107. void cdecl hfree(void huge *);
  108. void cdecl _nfree(void near *);
  109. void near * cdecl _nmalloc(size_t);
  110. size_t cdecl _nmsize(void near *);
  111. int cdecl _nheapwalk(struct _heapinfo *);
  112. int cdecl _fheapwalk(struct _heapinfo *);
  113.  
  114. #else
  115. #if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  116.  
  117. int _nheapwalk(struct _heapinfo *);
  118. int _fheapwalk(struct _heapinfo *);
  119.  
  120. #endif    /* M_I86CM || M_I86LM || M_I86HM */
  121.  
  122. #endif /* NO_EXT_KEYS */
  123.